using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter20
{
	/// <summary>
	/// Example04: Cooling the Steam
	/// What mass of steam initially at 130 C is needed to warm
	/// 200 g of water in a 100 g glass container from 20.0 C 
	/// to 50.0 C?
	/// m = 10.9 g
	/// </summary>
	public class Example04
	{
		public Example04()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Temperature ti = new L.Temperature();
			ti.C = 20.0;
			L.Temperature tf = new L.Temperature();
			tf.C = 50.0;
			L.SpecificHeat c1 = new L.SpecificHeat();
			c1.JPERkgPERCelsius = L.Constant.SpecificHeatOfWater;
			L.SpecificHeat c2 = new L.SpecificHeat();
			c2.JPERkgPERCelsius = 837.0;
			L.Mass m1 = new L.Mass();
			m1.kg = 0.2;
			L.Mass m2 = new L.Mass();
			m2.kg = 0.1;
			L.Heat Q1 = new L.Heat(m1,c1,ti,tf);
			L.Heat Q2 = new L.Heat(m2,c2,ti,tf);
			L.LatentHeat LH = new L.LatentHeat();
			LH.JPERkg = 2.26E6;

			L.Mass steammass = new L.Mass();
			steammass.kg = (Q1.J+Q2.J)/(LH.JPERkg + 2.01E3*(130.0-100.0) 
				+ L.Constant.SpecificHeatOfWater*(100.0- tf.C));

			result+=Convert.ToString(steammass.kg)+"\r\n";
		}
	}
}
